package com.start.shop.common.exception;

import org.springframework.http.HttpStatus;

import com.start.shop.common.constant.RspCode;

import lombok.Data;


@Data
public class MyException extends RuntimeException{

	/**
	 *
	 */
	private static final long serialVersionUID = -4137688758944857209L;
	
	/**
	 * http状态码
	 */
	private Integer httpCode;
	
	/**
	 * f返回码
	 */
	private  String code;

	/**
	 * @param httpStatus http状态码
	 */
	public MyException(RspCode rspcode, Integer httpCode ) {
		super(rspcode.getMessage());
		this.httpCode = httpCode;
		this.code = rspcode.getCode();
	}
	
	
	public MyException(RspCode rspcode) {
		super(rspcode.getMessage());
		this.httpCode = HttpStatus.OK.value();
		this.code = rspcode.getCode();
	}

	public MyException(String code, String msg) {
        super(msg);
	    this.httpCode = HttpStatus.OK.value();
		this.code = code;
	}
}
